<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>数组去重</title>
</head>
<body>
    <script>
        /*var  arr = [1,8,3,3,5,8,6,4,1];
        var newarr = []
        for(var i=0;i<arr.length;i++){
            // console.log(arr.indexOf(arr[i]));
            if (newarr.indexOf(arr[i]) == -1){
                newarr.push(arr[i])
            }
        }
        console.log(newarr);*/
        //面向对象面试题01
       /* function c1(name){
            if(name) this.name = name;
        };
        function c2(name){
            this.name = name
        };
        function c3(name){
            this.name = name||'json'
        };
        c1.prototype.name = 'tom';
        c2.prototype.name = 'tom';
        c3.prototype.name = 'tom';
        alert((new c1()).name+(new c2()).name+(new c3()).name);
        console.log((new c2()).name);
        console.log((new c3()).name);



        function fn(power,minzi){
            this.power = power;
            this.minzi = minzi;
        }
        var  red = new fn('red','powerranger')
        var black = new fn('black','powerrange')
        fn.prototype.nam = 'powerred';
        console.log(red.prototype)
        red.prototype.nam1 = 'Tony';
        // red.prototype.me = 'hulk';
        console.log(red);*/

        // red.prototype.nam  ='123';
        // black.prototype.nam = 'powerblack';
        // console.log(red.nam+'---'+black.nam);
        /*console.log(red.nam);
        console.log(black.nam);
        console.log(red.nam1);*/
      /*  function fn (){
           return function fn2(){
                var  a = 456;
                alert(789)
                return function fn3(){
                    alert(123)
                }
            }
        }

        var c = fn()
        // fn2()
        var fn3=c()
        fn3()
        c()
        // fn3()
        // alert(a)
        arr =[]
        console.log(arr is Array)*/
// 面试题03
        var str = 'world';
        (function(){
            if (typeof str == 'undefined'){
                var newStr = 'hulk';
                console.log("hello"+newStr);
            }else{
                console.log("hello"+str);
            }
        })();





    </script>
</body>
</html>